
set(HEADERS ${PROJECT_BINARY_DIR}/config.h
            common.h
            inifile.h
            loggerData.h
            paramconfig.h
            runner.h
            sipcall.h
            sipcore.h
            sipreg.h
            sipua.h)

set(SOURCES common.cpp
            inifile.cpp
            main.cpp
            paramconfig.cpp
            runner.cpp
            sipcall.cpp
            sipcore.cpp
            sipreg.cpp
            sipua.cpp)

set(INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include
                 ${PROJECT_SOURCE_DIR}/contrib
                 ${PROJECT_SOURCE_DIR}/src
                 ${PROJECT_BINARY_DIR})

IF(OS STREQUAL "win")
    include_directories(${INCLUDE_DIRS} "D:\\Program Files (x86)\\OpenSSL-Win32\\include")
    add_definitions(-D__STDC_CONSTANT_MACROS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
    link_directories("${PROJECT_SOURCE_DIR}/lib/Win32/Debug"
                     "D:\\Program Files (x86)\\OpenSSL-Win32\\lib")
    add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} eXosip.lib osip2.lib osipparser2.lib libcares.lib
                                          ares.lib winmm.lib rutil.lib
                                          openssl.lib libssl.lib libcrypto.lib
                                          Crypt32.lib Dnsapi.lib;Iphlpapi.lib ws2_32.lib Qwave.lib delayimp.lib)
ELSEIF(OS STREQUAL "ubuntu16.04")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -Wno-write-strings -fpermissive")
    include_directories(${INCLUDE_DIRS})
    link_directories("${PROJECT_SOURCE_DIR}/lib/ubuntu16.04")
    add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} eXosip2.a osip2.a osipparser2.a ares.a rutil.a pthread resolv)
ELSEIF(OS STREQUAL "centos6.8")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2  -Wall -fPIC -Wno-write-strings -rdynamic -fpermissive")
    include_directories(${INCLUDE_DIRS})
    link_directories("${PROJECT_SOURCE_DIR}/lib/centos6.8")
    add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} rutil eXosip2.a osip2.a osipparser2.a ssl pthread resolv rt)
ELSEIF(OS STREQUAL "arm-linux")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -fPIC -Wno-write-strings -rdynamic -fpermissive")
    include_directories(${INCLUDE_DIRS})
    link_directories("${PROJECT_SOURCE_DIR}/lib/hisiv400")
    add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} rutil eXosip2.a osip2.a osipparser2.a pthread resolv rt)
ELSE()
    MESSAGE(SEND_ERROR "Not supported OS option! - OS:${OS}. Choose 'win' or 'ubuntu16.04' or 'centos6.8' or 'arm-linux' with '-DOS=' option.")
ENDIF()

